package com.lyf.oop;

/**
 * @AUTHOR LYF
 * @DATE 2022/3/15
 * @VERSION 1.0
 * @DESC
 */
class Father{
    private int age;
    static int staticAge;
    static {
        System.out.println("加载父类的静态代码块");
    }
    public Father(){
        System.out.println("加载父类构造器");
    }
    static void staticMethod(){
        System.out.println("加载父类静态方法");
    }
    void method(){
        System.out.println("加载父类普通方法");
    }
}
class Son extends Father{
    private int age;
    static int staticAge;
    static {
        System.out.println("加载子类的静态代码块");
    }
    public Son(){
        System.out.println("加载子类构造器");
    }
    static void staticMethod(){
        System.out.println("加载静态方法");
    }
    void method(){
        System.out.println("加载子类普通方法");
    }
}


public class ClassLoaderDemo {
    static {
        System.out.println("执行代码块1");
    }
    static int fun(int a,int b){
        System.out.println(a+":"+b);
        return 0;
    }
    public static void main(String[] args) {
        new Son().method();
        int a=10;
        fun(a,a+=10);
    }
    static {
        System.out.println("执行代码块2");
    }
}
